package map;

import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Map;

public class MapDemo {
    public static void main(String[] args) {
        Map<String,Integer> map=new HashMap<>();
        Integer value= map.put("语文",99);
        System.out.println(value);
        map.put("化学",99);
        map.put("物理",99);
        map.put("数学",55);
        //System.out.println(value);
        value=map.put("数学",33);//返回的value只能用于key已经存在的语句
        System.out.println(map);
        System.out.println("首次value:"+value);
        map.put("政治",78);
        System.out.println(map);
        Integer in= map.remove("数学");
        System.out.println(map);
        System.out.println(in);
        System.out.println(map.containsKey("语文"));
        Map<String,Integer> map2=new HashMap<>();
        map2.putAll(map);

        map.clear();
        System.out.println(map);
        System.out.println(map.isEmpty());
        System.out.println(map2);
    }
}
